﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using WTwitter.Model.Framework;
using System.Runtime.Serialization.Json;

namespace WTwitter.Model.Twitter.Json {
	class DirectMessageReader : IItemsReader {
		#region IItemsReader メンバ

		public IEnumerable<ITimelineItem> Read(Stream source) {
			var serializer = new DataContractJsonSerializer(typeof(List<DirectMessage>));
			var result = serializer.ReadObject(source) as List<DirectMessage>;
			foreach (var item in result) {
				yield return new DirectMessageItem(item);
			}
		}

		#endregion
	}
}
